<?php
$data = array(
'game_id'=>'Mã game',
'game_title'=>'Tên game',
'game_file'=>'Tên file game',
'game_key'=>'Game key',
'game_min_scores'=>'Điểm tối thiểu',
'game_status'=>'Trạng thái',
);
$default = array();
echo $this->atheme->form_search($data,array(),$default);
?>

<a href="<?php echo admin_url();?>game.html"><span class="label label-warning">Game</span></a>
<a href="<?php echo admin_url();?>game/arena.html"><span class="label label-warning">Đấu trường</span></a>
<?php
$header = array(
	'ID'=>'', 
	'Tên game'=>'',
	'Ngày tạo'=>'', 
	'Lượt xem'=>'',

	);
$config = array(
    'header_icon' => @$this->resource->RES_ICON,
    'header_title' => 'Quản lý '.@$this->resource->RES_NAME,
    'add_title' => 'Thêm '.@$this->resource->RES_NAME,
    'ID' => '0',
    'showEdit' => false,
    'showDelete' => false,
    'showAdd' => false,
);
if ($this->permission->check("delete", $this->resource->RES_CODE))
    $config['showDelete'] = true;

if ($this->permission->check("update", $this->resource->RES_CODE))
    $config['showEdit'] = true;
	
if ($this->permission->check("insert", $this->resource->RES_CODE))
    $config['showAdd'] = true;

$data = array();
$stt = 0;
foreach ($datas as $result) {
	$prefix = '';
	if($result->game_status ==-3)
		$prefix = '<span class="label">Lưu tạm</span>';
	if($result->game_status ==-2)
		$prefix = '<span class="label label-info">Chờ test</span>';
	if($result->game_status ==-1)
		$prefix = '<span class="label label-warning">Chờ duyệt</span>';
	if($result->game_status ==0)
		$prefix = '<span class="label label-inverse">Ẩn</span>';
	
	if($result->game_status > 0)
		$prefix = '<span class="label label-success">Đang chạy</span>';
	
    $data[] = array($result->{$this->{$this->model}->primaryKey}, $result->{$this->{$this->model}->primaryKey}, $prefix.' '.$result->game_title, date("d/m/Y",$result->game_time_create), $result->game_view);
}
echo $this->atheme->table_simple($header, $data, $config);
?>

